package com.jacobson.core.widget.security.mgt

import com.jacobson.core.widget.security.Subject
import com.jacobson.core.widget.security.SubjectContext

/**
 * ================================================
 *
 * @author Wucz on 2018/8/7 9:24
 * ================================================
 */
class DefaultSubjectFactory : SubjectFactory {
    override fun createSubject(context: SubjectContext): Subject {
        val securityManager = context.resolveSecurityManager()
        val principal = context.resolvePrincipal()
        val authenticated = context.resolveAuthenticated()
        return DelegatingSubject(principal, authenticated, securityManager!!)
    }

}
